<%-- internal/maintain/menu-item/index.jsp --%>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<%@page import="java.util.*" %>
<%@page import="problemDomain.EmployeeAccountBean"%>
<%@page import="problemDomain.EmployeeAccountBean.Position"%>

<%
	// get the currently logged on employee from session
	EmployeeAccountBean employee = (EmployeeAccountBean)session.getAttribute("employee");
	EmployeeAccountBean.Position pos = null;
	if (employee != null)
		pos = employee.getPosition();
	else {
		response.sendRedirect("../../login/");
		return;
	}
	
	if (pos != Position.MANAGER) {
		response.sendRedirect("../../login/");
		return;
	}
%>



<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<link type="text/css" rel="stylesheet" href="../../css/general.css" />
		<link type="text/css" rel="stylesheet" href="../../css/framed.css" />
		<link type="text/css" rel="stylesheet" href="../../css/menu/form.css" />
		<script type="text/javascript" src="../../js/ajax-handler.js"></script>
		<script type="text/javascript" src="../../js/form.js"></script>
		<script type="text/javascript" src="../../js/dialog.js"></script>
		<script type="text/javascript" src="../../js/menu-item/maintain.js"></script>
		<script type="text/javascript" src="../../js/menu-item/form.js"></script>
		<title>ORDRS - Maintain Item Menu</title>
	</head>
		
	<body onload="loadPage()">
		<!-- Title -->
		<div class="pageTitle">
			<img src="../../images/logo.bmp" />
			<!-- Logout -->
			<div class="navi">
				<table class="navi" align="right">
					<tr>
					<%
					out.println("<td class=\"navi\"><a href=\"../delivery/\">Delivery</a></td>");
					out.println("<td class=\"navi\"><a href=\"../food-item/\">Food Item</a></td>");
					out.println("<td class=\"navi\"><a href=\"../employee/\">Employee</a></td>");
					out.println("<td class=\"navi\"><a href=\"../menu-item/\">Menu Item</a></td>");
					out.println("<td class=\"navi\"><a href=\"../menu/\">Order</a></td>");
					out.println("<td class=\"navi\"><a href=\"../../view/report/\">Report</a></td>");
					out.println("<td class=\"navi\"><a href=\"../reservation/\">Reservation</a></td>");
					%>
						
						<td class="navi"><a href="../../login/">Logout</a></td>
					</tr>
				</table>
			</div>
			<!-- END Logout -->
		</div>
		<!-- END Title -->			
			
		<!-- Panel -->
		<div class="panel">
		<fieldset>
		<legend>Maintain Menu Item</legend>
			<table style="border: 0px; width: 100%;">
				<tr style="height: 0">
					<td rowspan="3">
					
						<!-- Fields -->
						
						<div  class="fields">
							<!-- hidden inputs -->
							
							<input id="menuItemID" type="hidden" value="" />
							<input id="foodItemID" type="hidden" value="" />
							<input id="foodItemInMIID" type="hidden" value="" />
							
							<!-- END hidden inputs -->
							<table align="center">
								<tr>
									<td><h4>Menu Item Info</h4></td>
								</tr>
								<tr>
									<td class="fieldLabel">* Item No:</td>
									<td><input id="number" type="text" maxlength="4"/></td>
									<td id="numberMessage"></td>
								</tr>
								<tr>
									<td class="fieldLabel">* Name:</td>
									<td><input id="name" type="text" maxlength="25"/></td>
									<td id="nameMessage"></td>
								</tr>
								<tr>
									<td class="fieldLabel">* Price:</td>
									<td><input id="price" type="text" maxlength="8"/></td>
									<td id="priceMessage"></td>
								</tr>
								<tr>
									<td class="fieldLabel">Menu:</td>
									<td>
										<select id="menu">
										<option value="" selected="selected"></option>
										<optgroup id="menuOptGroup" label="Menu">
										</optgroup>
										</select>
									</td>
								</tr>
							</table>
							
						</div>
						
						<!-- END Fields -->
					</td>
					
				</tr>	
				<tr>
					<td rowspan="2" class="verrule" ></td>	
					<td class="resultsHead">Menu Item List
					</td>
					<td>
						<!-- List All Button -->
						<ul class="toolbar">
							<li onclick="listAllMenuItem()">List All</li>
						</ul> 
						
					</td>
				</tr>
				<tr>
					<td class="resultsTD" colspan="2">
						<!-- Results -->
						
						<div id="results" class="resultsPanel">
						</div>
						
						<!-- END Results -->
					
					</td>
				</tr>
				<tr valign="top">
					<td class="menuTD">
						<!-- Food Item in Menu Item List -->
						
						<h4>Food Items in this Menu Item</h4>
								
						<div id="foodItemInMIList" class="orderItemListPanel"></div>
						
						<!-- END Food Item in Menu Item List -->
					</td>
					<td>
						
						<!-- Add/Remove Buttons -->
						<div class="addRemovePanel">
							<table align="center">
								<tr><td><br><br><br></td>
								</tr>
								<tr>
									<td class="buttonTD"><input type="button" onclick="addItem()" value="&lt"/></td>
								</tr>
								<tr><td><br><br></td>
								</tr>
								<tr>
									<td class="buttonTD"><input type="button" onclick="removeItem()" value="&gt"/></td>
								</tr>
								<tr><td><br><br></td>
								</tr>
							</table>
						
						</div>
						<!-- END Add/Remove Buttons -->
						
					</td>
					<td colspan="2" class="menuTD">
					
						<!-- Food Item Panel -->
						
						<h4>Food Item</h4>
						<form name="showOpForm">
							<input type="radio" name="showOp" onclick="listFoodItem()"/>All Food Items
							<input type="radio" name="showOp" onclick="listFoodItem()"/>Available Food Items
						</form>
						
						<div id="foodItemList" class="menuItemListPanel"></div>
						
						<!-- END Food Item Panel -->
					
					</td>
				</tr>
				
				<tr>
					<td style="vertical-align: top; padding-top: 10px;" align="center">
						<!-- Toolbar -->
						<ul class="toolbar">
							<li onclick="createMenuItem(false)">Create</li>
							<li onclick="reportMenuItem()">Search</li>
							<li onclick="updateMenuItem()">Update</li>
							<li onclick="deleteMenuItem()">Delete</li>
							<li onclick="resetFields()">Clear</li>
						</ul>
						<!-- END Toolbar -->
					
					</td>
					<td>
					</td>
					<td>
						<table align="center">
							<tr>
								<td rowspan="2">Search an Item</td>
								<td class="fieldLabel">Name:</td>
								<td><input type="text" id="foodItemName" maxlength="25" /></td>
							</tr>	
							<tr>
								<td class="fieldLabel">Type:</td>
								<td><input type="text" id="foodItemType" maxlength="25" /></td>
							</tr>
						</table>
					</td>
					<td>
						<ul class="toolbar">
							<li onclick="searchFoodItem()">Search</li>
						</ul>
					</td>
				</tr>
			</table>
		</fieldset>
		</div>
		<!-- END Panel -->
	</body>
</html>
